<%@page import="com.eos.common.tool.ObjectUtils"%>
<%@page import="com.eos.orm.mybatis.model.SysCustomer"%>
<%@page import="com.eos.orm.mybatis.model.ViewBrokerageReport"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html; charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<% 
List<ViewBrokerageReport> reportList = (List<ViewBrokerageReport>)request.getAttribute("reportList");
List<SysCustomer> customerList = (List<SysCustomer>) request.getAttribute("customerList");
%>
<style>
.searchBar  label{width: 60px;}
</style>
<form id="pagerForm" method="post" action="commissionRptList">	
	<input type="hidden" name="pageNum" value="${param.pageNum}" />	
</form>
<div class="pageHeader">
	<form onsubmit="return navTabSearch(this);" rel="pagerForm"  method="post" action="commissionRptList">
	<div class="searchBar" >
	<input type="hidden" name="numPerPage" value="${numPerPage}" />
	<input type="hidden" name="pageNum" value="${pageNum}" /> 
	<table class="searchContent" >
			<tr>
				<td>
					 <label>结算客户：</label> 
                     <select name="customerId" class="combox">
                     	<option value="">-选择结算客户-</option>
                     	<c:forEach var="cu" items="${customerList }">
                     	<option value="${cu.id }" <c:if test="${cu.id eq customerId }">selected="selected"</c:if>>${cu.customerName }</option>
                     	</c:forEach>
                     </select>
				</td>
				<td style="padding-right:0;">
					 <label  style="float:left;">佣金月份：</label>
				     <input type="text" name="startTime" datefmt="yyyy-MM" size="16" value="${startTime }" class="date" style="float:left;" readonly="readonly"/>
					 <a class="inputDateButton" href="javascript:;">选择</a>
				</td>	
				<td>
					<label style="width:10px; padding-right:8px;">~~</label>
				  	 <input type="text" name="endTime" datefmt="yyyy-MM" size="16" value="${endTime }" class="date" style="float:left;" readonly="readonly"/>
					 <a class="inputDateButton" href="javascript:;">选择</a>
				</td>			
				<td>
					<label>核对状态：</label> 
                    <select class="combox"  name="status">
                       <option value='' <c:if test="${status eq '' }">selected="selected"</c:if>>全部</option>
                       <option value='0' <c:if test="${status eq '0'}">selected="selected"</c:if>>未核对</option>
                       <option value='1' <c:if test="${status eq '1'}">selected="selected"</c:if>}>已核对</option>   
                       <option value='2' <c:if test="${status eq '2'}">selected="selected"</c:if>}>核对中</option>                         
                     </select>
				</td>
				<td>
					 <div class="subBar">
						<ul>
							<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
						</ul>
					</div>
				</td>
			</tr>
		</table>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li>
				<a class="add" width="440" height="265" style="font-weight: bold;color:#4BBB13;" href="uploadCommissionExcel?navTabId=uploadCommissionExcel" target="dialog" maxable="false" mask="true"><span>导入佣金明细Excel</span>
				</a>
			</li>  
		</ul>
	</div>
	<table class="table" width="100%" layoutH="115">
		<thead>
			<tr>
				<th>序号</th>
                <th>结算客户</th>
                <th>对账日期</th>
                <th>创建时间</th> 
                <th>核对时间</th>  
                <th>状态</th>
                <th>操作</th>
			</tr>
		</thead>
		<tbody>
		   <% 
		   if(null != reportList){
		   	int i = 1;
		   	for(ViewBrokerageReport rpt : reportList){
		   	String status = rpt.getStatus();
		   	%>
		   		<tr>
		   			<td><%=i++ %></td>
		   			<td>
		   			<% 
		   			 if(null != customerList){
		   			    for(SysCustomer su : customerList){
		   			      if(rpt.getCustomerId().intValue() == rpt.getCustomerId()){
		   			      	out.print(su.getCustomerName());
		   			      	break;
		   			      }
		   			    }
		   			 }
		   			%>
		   			</td>
		   			<td><%=rpt.getSettlementAccount() %></td>
		   			<td><%=rpt.getInsertTime() %></td>
		   			<td><%=rpt.getModifyTime()== null ? "" : rpt.getModifyTime() %></td>
		   			<td>
		   			<% 
		   			  if("0".equals(status)){
		   		  %>
		              	  	<a style='text-decoration:none;color: #f00;'>未核对</a>
		             <% }else if("1".equals(status)){%>
		              	 	<a style='text-decoration:none;color: #006400;'>已核对</a>
		              <%}else if("2".equals(status)){%>
		              	  	<a style='text-decoration:none;color: #00f;'>核对中</a>
		           <%   }
		   			%>
		   			</td>
		   			<td>
		   			  <% 
		   			     if("0".equals(status)){
		   			  %>
		   			     <a href="" style="color:#00f; text-decoration: underline;">点 击 核 对</a>
		   			 <% }
		   			  %>
		   			  &nbsp;&nbsp;
		   			<a href="commissionList?navTabId=commissionDeail&customerId=<%=rpt.getCustomerId() %>&startTime=<%=rpt.getSettlementAccount() %>" style="color:#6495ED;text-decoration: underline;" target="navTab" title="佣金明细">查看详情</a>
		   			</td>
		   		</tr>
		   	<%}
		   }
		   %>
		</tbody>
	</table>

	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<!-- pageNum:1是当更改numPerPage时，使pageNum=1重新开始，否则可能无数据 -->
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value,pageNum:1})">
				<option value="15" ${numPerPage==15?'selected':''}>15</option>
				<option value="20" ${numPerPage==20?'selected':''}>20</option>
				<option value="25" ${numPerPage==25?'selected':''}>25</option>
				<option value="50" ${numPerPage==50?'selected':''}>50</option>
				<option value="100" ${numPerPage==100?'selected':''}>100</option>
			</select>
			<span>条，共${totalCount }条 </span>
		</div>		
		<div class="pagination" targetType="navTab" totalCount="${totalCount }" numPerPage="${numPerPage}" pageNumShown="5" currentPage="${pageNum }"></div>
	</div>
</div>
